import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
    { path: '/oaPhoneLogin', name: 'oaPhoneLogin', component: r => { require(['@/login/oaPhoneLogin.vue'], r) }, meta: { title: 'console 登录' }},
  { path: '/', name: 'login', component: r => { require(['@/login/LoginPage.vue'], r) }, meta: { title: 'console 登录' }},
  {
    path: '/oa-callback', name: 'OACallback',component: r => { require(['@/login/OACallBack.vue'], r) }, meta: { title: 'oa 登录' },
  },
  {
    path: '/main', name: 'main', redirect: '/test/index', component: r => { require(['@views/MainPage.vue'], r) },
    children: [
      {name: 'home', path: '/main/home', component: r => { require(['@views/tabs/TabHome.vue'], r) }, meta: {keepAlive: true}},

      {name: 'work', path: '/main/work', component: r => { require(['@views/tabs/TabWork.vue'], r) }, meta: {keepAlive: true}},


      {name: 'wait', path: '/main/wait', component: r => { require(['@views/tabs/TabWait.vue'], r) }, meta: {keepAlive: true}},

      {name: 'apply', path: '/main/apply', component: r => { require(['@views/tabs/TabApply.vue'], r) }, meta: {keepAlive: true}},


      {name: 'draft', path: '/main/home-draft', component: r => { require(['@views/tabs/TabDraft.vue'], r) }, meta: {keepAlive: true}},

      {name: 'mine', path: '/main/mine', component: r => { require(['@views/tabs/TabMine.vue'], r) }, meta: {keepAlive: true}},

      {name: 'personalHome', path: '/main/personalHome', component: r => { require(['@views/personal/personalHome.vue'], r) }, meta: {keepAlive: false}},

      {name: 'personalDetails', path: '/personal/personalDetails', component: r => { require(['@views/personal/personalDetails.vue'], r) }, meta: {keepAlive: false}},

      // {name: 'test', path: '/app/test', component: r => { require(['@views/tabs/TabTest.vue'], r) }, meta: {keepAlive: false}},
     {name: 'personalEdit', path: '/personal/personalEdit', component: r => { require(['@views/personal/personalEdit.vue'], r) }, meta: {keepAlive: false}},

     {name: 'coordination', path: '/coordination',redirect: '/coordination/chat', component: r => { require(['@views/chat/chatList.vue'], r) }, meta: {keepAlive: false}},

     {name: 'chat', path: '/coordination/chat', component: r => { require(['@views/chat/chatList.vue'], r) }, meta: {keepAlive: true}},

     {name: 'contact', path: '/coordination/contact', component: r => { require(['@views/chat/contact.vue'], r) }, meta: {keepAlive: false}},

     {name: 'chatting', path: '/coordination/chat/:id', component: r => { require(['@views/chat/chat.vue'], r) }, meta: {keepAlive: false}},

     {name: 'chatting', path: '/coordination/chat/bot/:id', component: r => { require(['@views/chat/chatbot.vue'], r) }, meta: {keepAlive: false}},

        {name: 'createGroup', path: '/coordination/createGroup', component: r => { require(['@views/chat/createGroup.vue'], r) }, meta: {keepAlive: false}},

     {name: 'myHome', path: '/coordination/myHome', component: r => { require(['@views/chat/myHome.vue'], r) }, meta: {keepAlive: false}},

     {name: 'myRobot', path: '/coordination/myHome/myRobot', component: r => { require(['@views/chat/myRobot.vue'], r) }, meta: {keepAlive: false}},

     {name: 'chooseRobot', path: '/coordination/myHome/chooseRobot', component: r => { require(['@views/chat/chooseRobot.vue'], r) }, meta: {keepAlive: false}},

     {name: 'addRobot', path: '/coordination/myHome/addRobot/:type', component: r => { require(['@views/chat/addRobot.vue'], r) }, meta: {keepAlive: false}},

     {name: 'robotDetail', path: '/coordination/myHome/robotDetail', component: r => { require(['@views/chat/robotDetail.vue'], r) }, meta: {keepAlive: false}},

     {name: 'addfriend', path: '/coordination/myHome/addfriend', component: r => { require(['@views/chat/addfriend.vue'], r) }, meta: {keepAlive: false}},

     {name: 'configurationdescription', path: '/coordination/myHome/configurationdescription', component: r => { require(['@views/chat/configurationdescription.vue'], r) }, meta: {keepAlive: false}},

     {name: 'gosearch', path: '/coordination/myHome/gosearch', component: r => { require(['@views/chat/gosearch.vue'], r) }, meta: {keepAlive: false}},

     {name: 'friendverification', path: '/coordination/myHome/friendverification', component: r => { require(['@views/chat/friendverification.vue'], r) }, meta: {keepAlive: false}},
     {name: 'newFriend', path: '/coordination/myHome/newFriend', component: r => { require(['@views/chat/newFriend.vue'], r) }, meta: {keepAlive: false}},

     {name: 'groupInformation', path: '/coordination/chat/groupInformation', component: r => { require(['@views/chat/groupInformation.vue'], r) }, meta: {keepAlive: false}},

     {name: 'addGroupMember', path: '/coordination/chat/addGroupMember', component: r => { require(['@views/chat/addGroupMember.vue'], r) }, meta: {keepAlive: false}},

     //个人工作台
     {name: 'test', path: '/test/index', component: r => { require(['@views/test/test.vue'], r) }, meta: {keepAlive: false}},
     //能力市场
     {name: 'capabilitymarket', path: '/test/capabilitymarket', component: r => { require(['@views/test/capabilitymarket.vue'], r) }, meta: {keepAlive: false}},
     //能力助手
     {name: 'abilityassistant', path: '/test/abilityassistant', component: r => { require(['@views/test/abilityassistant.vue'], r) }, meta: {keepAlive: false}},
     //我的审批
     {name: 'myapproval', path: '/test/myapproval', component: r => { require(['@views/test/myapproval.vue'], r) }, meta: {keepAlive: false}},

        {name: 'actuator', path: '/actuator/index', component: r => { require(['@views/test/components/actuator/index.vue'], r) }, meta: {keepAlive: false}},

     {name: 'Information', path: '/Information/index', component: r => { require(['@views/test/components/Information/index.vue'], r) }, meta: {keepAlive: false}},

     {name: 'subscription', path: '/subscription/index', component: r => { require(['@views/test/components/subscription/index.vue'], r) }, meta: {keepAlive: false}},

     {name: 'configuration', path: '/configuration/index', component: r => { require(['@views/test/components/configuration/index.vue'], r) }, meta: {keepAlive: false}},

     {name: 'subscriptionDetails', path: '/subscriptionDetails/index', component: r => { require(['@views/test/components/subscriptionDetails/index.vue'], r) }, meta: {keepAlive: false}}
    ],
    meta: {keepAlive: true}
  },
];


let router = new VueRouter({
  routes: routes
});

router.$addRoutes = (params) => {
  router.matcher = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
  }).matcher;
  router.addRoutes(params)
};

export default router
